home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2006 May / PCWMAY06.iso / Software / Freeware / First Page 2006 3.00 / fp2006-final-3.00-setup.exe / {app} / Iscripts / Forms Misc / country-chooser.izs < prev    next >
Text File  |  2005-09-28  |  12KB  |  535 lines

  1. <!NOWIZARD>
  2.  
  3. <!TITLE>Country Chooser
  4. <!/TITLE>
  5.  
  6. <!DESCRIPTION>This script waits for your choose what region your from and then gives you a second menu depending on what you picked in the first one!<!/DESCRIPTION> 
  7.  
  8. <!CATEGORY>Forms<!/CATEGORY>
  9.  
  10. <!SCRIPT>
  11. <!-- START OF SCRIPT -->
  12.  
  13. <!-- HOW TO INSTALL COUNTRY CHOOSER:
  14.  
  15.    1.  Paste the first code in the HEAD of your HTML document
  16.    2.  Add the last coding to the BODY of your HTML document  -->
  17.  
  18. <!-- STEP ONE: Paste the first code in the HEAD of your HTML document  -->
  19.  
  20. <HEAD>
  21.  
  22. <SCRIPT LANGUAGE="JavaScript">
  23.  
  24. <!-- Begin
  25. var africaArray =  new Array("('Select country','',true,true)",
  26. "('Ethiopia')",
  27. "('Somalia')",
  28. "('South Africa')",
  29. "('Other')");
  30. var middleeastArray =  new Array("('Select country','',true,true)",
  31. "('Egypt')",
  32. "('Iran')",
  33. "('Israel')",
  34. "('Kuwait')",
  35. "('Lebanon')",
  36. "('Morocco')",
  37. "('Saudi Arabia')",
  38. "('Syria')",
  39. "('Turkey')",
  40. "('U. A. Emirates')",
  41. "('Other')");
  42. var asiaArray =  new Array("('Select country','',true,true)",
  43. "('Armenia')",
  44. "('Bangladesh')",
  45. "('Cambodia')",
  46. "('China')",
  47. "('India')",
  48. "('Indonesia')",
  49. "('Japan')",
  50. "('Malaysia')",
  51. "('Myanmar')",
  52. "('Nepal')",
  53. "('Pakistan')",
  54. "('Philippines')",
  55. "('Singapore')",
  56. "('South Korea')",
  57. "('Sri Lanka')",
  58. "('Taiwan')",
  59. "('Thailand')",
  60. "('Uzbekistan')",
  61. "('Vietnam')",
  62. "('Other')");
  63. var europeArray =  new Array("('Select country','',true,true)",
  64. "('Albania')",
  65. "('Austria')",
  66. "('Belarus')",
  67. "('Belgium')",
  68. "('Bosnia')",
  69. "('Bulgaria')",
  70. "('Croatia')",
  71. "('Cyprus')",
  72. "('Czech Rep.')",
  73. "('Denmark')",
  74. "('Estonia')",
  75. "('Finland')",
  76. "('France')",
  77. "('Germany')",
  78. "('Greece')",
  79. "('Hungary')",
  80. "('Iceland')",
  81. "('Ireland')",
  82. "('Italy')",
  83. "('Latvia')",
  84. "('Liechtenstein')",
  85. "('Lithuania')",
  86. "('Luxembourg')",
  87. "('Macedonia')",
  88. "('Malta')",
  89. "('Monaco')",
  90. "('Netherlands')",
  91. "('Norway')",
  92. "('Poland')",
  93. "('Portugal')",
  94. "('Romania')",
  95. "('Russia')",
  96. "('Slovakia')",
  97. "('Slovenia')",
  98. "('Spain')",
  99. "('Sweden')",
  100. "('Switzerland')",
  101. "('Ukraine')",
  102. "('United Kingdom')",
  103. "('Other')");
  104. var australiaArray =  new Array("('Select country','',true,true)",
  105. "('Australia')",
  106. "('New Zealand')",
  107. "('Other')");
  108. var lamericaArray =  new Array("('Select country','',true,true)",
  109. "('Costa Rica')",
  110. "('Cuba')",
  111. "('El Salvador')",
  112. "('Guatemala')",
  113. "('Haiti')",
  114. "('Jamaica')",
  115. "('Mexico')",
  116. "('Panama')",
  117. "('Other')");
  118. var namericaArray =  new Array("('Select country','',true,true)",
  119. "('Canada')",
  120. "('USA')",
  121. "('Other')");
  122. var samericaArray =  new Array("('Select country','',true,true)",
  123. "('Argentina')",
  124. "('Bolivia')",
  125. "('Brazil')",
  126. "('Chile')",
  127. "('Colombia')",
  128. "('Ecuador')",
  129. "('Paraguay')",
  130. "('Peru')",
  131. "('Suriname')",
  132. "('Uruguay')",
  133. "('Venezuela')",
  134. "('Other')");
  135. function populateCountry(inForm,selected) {
  136. var selectedArray = eval(selected + "Array");
  137. while (selectedArray.length < inForm.country.options.length) {
  138. inForm.country.options[(inForm.country.options.length - 1)] = null;
  139. }
  140. for (var i=0; i < selectedArray.length; i++) {
  141. eval("inForm.country.options[i]=" + "new Option" + selectedArray[i]);
  142. }
  143. if (inForm.region.options[0].value == '') {
  144. inForm.region.options[0]= null;
  145. if ( navigator.appName == 'Netscape') {
  146. if (parseInt(navigator.appVersion) < 4) {
  147. window.history.go(0);
  148. }
  149. else {       
  150. if (navigator.platform == 'Win32' || navigator.platform == 'Win16') {
  151. window.history.go(0);
  152.             }
  153.          }
  154.       }
  155.    }
  156. }
  157. function populateUSstate(inForm,selected) {  
  158. var stateArray =  new Array("('Select State','',true,true)",
  159. "('Alabama')",
  160. "('Alaska')",
  161. "('Arizona')",
  162. "('Arkansas')",
  163. "('California')",
  164. "('Colorado')",
  165. "('Connecticut')",
  166. "('Delaware')",
  167. "('Columbia')",
  168. "('Florida')",
  169. "('Georgia')",
  170. "('Hawaii')",
  171. "('Idaho')",
  172. "('Illinois')",
  173. "('Indiana')",
  174. "('Iowa')",
  175. "('Kansas')",
  176. "('Kentucky')",
  177. "('Louisiana')",
  178. "('Maine')",
  179. "('Maryland')",
  180. "('Massachusetts')",
  181. "('Michigan')",
  182. "('Minnesota')",
  183. "('Mississippi')",
  184. "('Missouri')",
  185. "('Montana')",
  186. "('Nebraska')",
  187. "('Nevada')",
  188. "('New Hampshire')",
  189. "('New Jersey')",
  190. "('New Mexico')",
  191. "('New York')",
  192. "('North Carolina')",
  193. "('North Dakota')",
  194. "('Ohio')",
  195. "('Oklahoma')",
  196. "('Oregon')",
  197. "('Pennsylvania')",
  198. "('Rhode Island')",
  199. "('South Carolina')",
  200. "('South Dakota')",
  201. "('Tennessee')",
  202. "('Texas')",
  203. "('Utah')",
  204. "('Vermont')",
  205. "('Virginia')",
  206. "('Washington')",
  207. "('West Virginia')",
  208. "('Wisconsin')",
  209. "('Wyoming')");
  210. if (selected == 'USA') {
  211. for (var i=0; i < stateArray.length; i++) {
  212. eval("inForm.country.options[i]=" + "new Option" + stateArray[i]);
  213. }
  214. if ( navigator.appName == 'Netscape') {
  215. if (parseInt(navigator.appVersion) < 4) {
  216. window.history.go(0)
  217. }
  218. else {        
  219. if (navigator.platform == 'Win32' || navigator.platform == 'Win16') {
  220. window.history.go(0)
  221.          }
  222.       }
  223.    }
  224. }
  225. else {
  226. }  
  227. if (selected == 'Other') {
  228. newCountry = "";
  229. while (newCountry == ""){
  230. newCountry=prompt ("Please enter the name of your country.", "");
  231. }
  232. if (newCountry != null) {
  233. inForm.country.options[(inForm.country.options.length-1)]=new Option(newCountry,newCountry,true,true);
  234. inForm.country.options[inForm.country.options.length]=new Option('Other, not listed','Other');
  235.    }
  236. }
  237. if(inForm.country.options[0].text == 'Select country') {
  238. inForm.country.options[0]= null;
  239.    }
  240. }
  241. // End -->
  242. </script>
  243.  
  244. <!-- STEP TWO: Add the last coding to the BODY of your HTML document  -->
  245.  
  246. <BODY>
  247.  
  248. <center>
  249. <form name="globe">
  250. <select name="region" onChange="populateCountry(document.globe,document.globe.region.options[document.globe.region.selectedIndex].value)">
  251. <option selected value=''>Select Region</option>
  252. <option value='asia'>Asia</option>
  253. <option value='africa'>Africa</option>
  254. <option value='australia'>Australia</option>
  255. <option value='europe'>Europe</option>
  256. <option value='middleeast'>Middle East</option>
  257. <option value='lamerica'>Latin America</option>
  258. <option value='namerica'>North America</option>
  259. <option value='samerica'>South America</option>
  260. </select>
  261. <select name="country" onChange="populateUSstate(document.globe,document.globe.country.options[document.globe.country.selectedIndex].text)">
  262. <option value=''><--------------------</option>
  263. </select>
  264. </form>
  265. </center>
  266.  
  267.  
  268.  
  269. <!-- END OF SCRIPT -->
  270. <!/SCRIPT>
  271.  
  272. <!PREVIEW>
  273. <!-- START OF SCRIPT -->
  274.  
  275. <!-- HOW TO INSTALL COUNTRY CHOOSER:
  276.  
  277.    1.  Paste the first code in the HEAD of your HTML document
  278.    2.  Add the last coding to the BODY of your HTML document  -->
  279.  
  280. <!-- STEP ONE: Paste the first code in the HEAD of your HTML document  -->
  281.  
  282. <HEAD>
  283.  
  284. <SCRIPT LANGUAGE="JavaScript">
  285.  
  286. <!-- Begin
  287. var africaArray =  new Array("('Select country','',true,true)",
  288. "('Ethiopia')",
  289. "('Somalia')",
  290. "('South Africa')",
  291. "('Other')");
  292. var middleeastArray =  new Array("('Select country','',true,true)",
  293. "('Egypt')",
  294. "('Iran')",
  295. "('Israel')",
  296. "('Kuwait')",
  297. "('Lebanon')",
  298. "('Morocco')",
  299. "('Saudi Arabia')",
  300. "('Syria')",
  301. "('Turkey')",
  302. "('U. A. Emirates')",
  303. "('Other')");
  304. var asiaArray =  new Array("('Select country','',true,true)",
  305. "('Armenia')",
  306. "('Bangladesh')",
  307. "('Cambodia')",
  308. "('China')",
  309. "('India')",
  310. "('Indonesia')",
  311. "('Japan')",
  312. "('Malaysia')",
  313. "('Myanmar')",
  314. "('Nepal')",
  315. "('Pakistan')",
  316. "('Philippines')",
  317. "('Singapore')",
  318. "('South Korea')",
  319. "('Sri Lanka')",
  320. "('Taiwan')",
  321. "('Thailand')",
  322. "('Uzbekistan')",
  323. "('Vietnam')",
  324. "('Other')");
  325. var europeArray =  new Array("('Select country','',true,true)",
  326. "('Albania')",
  327. "('Austria')",
  328. "('Belarus')",
  329. "('Belgium')",
  330. "('Bosnia')",
  331. "('Bulgaria')",
  332. "('Croatia')",
  333. "('Cyprus')",
  334. "('Czech Rep.')",
  335. "('Denmark')",
  336. "('Estonia')",
  337. "('Finland')",
  338. "('France')",
  339. "('Germany')",
  340. "('Greece')",
  341. "('Hungary')",
  342. "('Iceland')",
  343. "('Ireland')",
  344. "('Italy')",
  345. "('Latvia')",
  346. "('Liechtenstein')",
  347. "('Lithuania')",
  348. "('Luxembourg')",
  349. "('Macedonia')",
  350. "('Malta')",
  351. "('Monaco')",
  352. "('Netherlands')",
  353. "('Norway')",
  354. "('Poland')",
  355. "('Portugal')",
  356. "('Romania')",
  357. "('Russia')",
  358. "('Slovakia')",
  359. "('Slovenia')",
  360. "('Spain')",
  361. "('Sweden')",
  362. "('Switzerland')",
  363. "('Ukraine')",
  364. "('United Kingdom')",
  365. "('Other')");
  366. var australiaArray =  new Array("('Select country','',true,true)",
  367. "('Australia')",
  368. "('New Zealand')",
  369. "('Other')");
  370. var lamericaArray =  new Array("('Select country','',true,true)",
  371. "('Costa Rica')",
  372. "('Cuba')",
  373. "('El Salvador')",
  374. "('Guatemala')",
  375. "('Haiti')",
  376. "('Jamaica')",
  377. "('Mexico')",
  378. "('Panama')",
  379. "('Other')");
  380. var namericaArray =  new Array("('Select country','',true,true)",
  381. "('Canada')",
  382. "('USA')",
  383. "('Other')");
  384. var samericaArray =  new Array("('Select country','',true,true)",
  385. "('Argentina')",
  386. "('Bolivia')",
  387. "('Brazil')",
  388. "('Chile')",
  389. "('Colombia')",
  390. "('Ecuador')",
  391. "('Paraguay')",
  392. "('Peru')",
  393. "('Suriname')",
  394. "('Uruguay')",
  395. "('Venezuela')",
  396. "('Other')");
  397. function populateCountry(inForm,selected) {
  398. var selectedArray = eval(selected + "Array");
  399. while (selectedArray.length < inForm.country.options.length) {
  400. inForm.country.options[(inForm.country.options.length - 1)] = null;
  401. }
  402. for (var i=0; i < selectedArray.length; i++) {
  403. eval("inForm.country.options[i]=" + "new Option" + selectedArray[i]);
  404. }
  405. if (inForm.region.options[0].value == '') {
  406. inForm.region.options[0]= null;
  407. if ( navigator.appName == 'Netscape') {
  408. if (parseInt(navigator.appVersion) < 4) {
  409. window.history.go(0);
  410. }
  411. else {       
  412. if (navigator.platform == 'Win32' || navigator.platform == 'Win16') {
  413. window.history.go(0);
  414.             }
  415.          }
  416.       }
  417.    }
  418. }
  419. function populateUSstate(inForm,selected) {  
  420. var stateArray =  new Array("('Select State','',true,true)",
  421. "('Alabama')",
  422. "('Alaska')",
  423. "('Arizona')",
  424. "('Arkansas')",
  425. "('California')",
  426. "('Colorado')",
  427. "('Connecticut')",
  428. "('Delaware')",
  429. "('Columbia')",
  430. "('Florida')",
  431. "('Georgia')",
  432. "('Hawaii')",
  433. "('Idaho')",
  434. "('Illinois')",
  435. "('Indiana')",
  436. "('Iowa')",
  437. "('Kansas')",
  438. "('Kentucky')",
  439. "('Louisiana')",
  440. "('Maine')",
  441. "('Maryland')",
  442. "('Massachusetts')",
  443. "('Michigan')",
  444. "('Minnesota')",
  445. "('Mississippi')",
  446. "('Missouri')",
  447. "('Montana')",
  448. "('Nebraska')",
  449. "('Nevada')",
  450. "('New Hampshire')",
  451. "('New Jersey')",
  452. "('New Mexico')",
  453. "('New York')",
  454. "('North Carolina')",
  455. "('North Dakota')",
  456. "('Ohio')",
  457. "('Oklahoma')",
  458. "('Oregon')",
  459. "('Pennsylvania')",
  460. "('Rhode Island')",
  461. "('South Carolina')",
  462. "('South Dakota')",
  463. "('Tennessee')",
  464. "('Texas')",
  465. "('Utah')",
  466. "('Vermont')",
  467. "('Virginia')",
  468. "('Washington')",
  469. "('West Virginia')",
  470. "('Wisconsin')",
  471. "('Wyoming')");
  472. if (selected == 'USA') {
  473. for (var i=0; i < stateArray.length; i++) {
  474. eval("inForm.country.options[i]=" + "new Option" + stateArray[i]);
  475. }
  476. if ( navigator.appName == 'Netscape') {
  477. if (parseInt(navigator.appVersion) < 4) {
  478. window.history.go(0)
  479. }
  480. else {        
  481. if (navigator.platform == 'Win32' || navigator.platform == 'Win16') {
  482. window.history.go(0)
  483.          }
  484.       }
  485.    }
  486. }
  487. else {
  488. }  
  489. if (selected == 'Other') {
  490. newCountry = "";
  491. while (newCountry == ""){
  492. newCountry=prompt ("Please enter the name of your country.", "");
  493. }
  494. if (newCountry != null) {
  495. inForm.country.options[(inForm.country.options.length-1)]=new Option(newCountry,newCountry,true,true);
  496. inForm.country.options[inForm.country.options.length]=new Option('Other, not listed','Other');
  497.    }
  498. }
  499. if(inForm.country.options[0].text == 'Select country') {
  500. inForm.country.options[0]= null;
  501.    }
  502. }
  503. // End -->
  504. </script>
  505.  
  506. <!-- STEP TWO: Add the last coding to the BODY of your HTML document  -->
  507.  
  508. <BODY>
  509.  
  510. <center>
  511. <form name="globe">
  512. <select name="region" onChange="populateCountry(document.globe,document.globe.region.options[document.globe.region.selectedIndex].value)">
  513. <option selected value=''>Select Region</option>
  514. <option value='asia'>Asia</option>
  515. <option value='africa'>Africa</option>
  516. <option value='australia'>Australia</option>
  517. <option value='europe'>Europe</option>
  518. <option value='middleeast'>Middle East</option>
  519. <option value='lamerica'>Latin America</option>
  520. <option value='namerica'>North America</option>
  521. <option value='samerica'>South America</option>
  522. </select>
  523. <select name="country" onChange="populateUSstate(document.globe,document.globe.country.options[document.globe.country.selectedIndex].text)">
  524. <option value=''><--------------------</option>
  525. </select>
  526. </form>
  527. </center>
  528.  
  529.  
  530.  
  531. <!-- END OF SCRIPT -->
  532. <!/PREVIEW>
  533.  
  534. <!RELATED>NONE<!/RELATED>
  535.